﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace inventory.forms
{
   
    public partial class optionStatementtInventory : application.forms.dialogWithOption
    {
        public optionStatementtInventory()
        {
            InitializeComponent();
            optionsCb.Items.Clear();
            optionsCb.Items.Add(new common.myTypes.ComboBoxItem("Lệnh xuất kho", FormTypes.InventoryStatement.ToString()));
            optionsCb.Items.Add(new common.myTypes.ComboBoxItem("Lệnh thu hồi", FormTypes.InventoryStatementReturn.ToString()));
            optionsCb.SelectedIndex = 0;
        }

        public enum FormTypes { InventoryStatement, InventoryStatementReturn }
        public class Options
        {
            public FormTypes type = FormTypes.InventoryStatement;
            public bool printWithDetail = false;
        }
        Options _myOption = new Options();
        public Options myOption
        {
            get
            {
                _myOption.printWithDetail = printDetailChk.Checked;
                switch (optionsCb.SelectedIndex)
                {
                    case 0: _myOption.type  = FormTypes.InventoryStatement; break;
                    case 1: _myOption.type = FormTypes.InventoryStatementReturn; break;
                }
                return _myOption;
            }
            set
            {
                printDetailChk.Checked = value.printWithDetail;
                switch (value.type)
                {
                    case FormTypes.InventoryStatement: optionsCb.SelectedIndex = 0; break;
                    default: optionsCb.SelectedIndex = 1; break;
                }
            }
        }
    }
}
